#! /usr/bin/python
#coding: utf-8

import chinacQA.Static
import sys


def WriteDefaultC(paras):  
    if(len(paras) == 6):
        with open(chinacQA.Static.configurePath+"testEnvironment.ini","r") as f:
            lines = f.readlines() 
        with open(chinacQA.Static.configurePath+"testEnvironment.ini","w") as f_w:
            for line in lines:
                if 'TargeWebPage' in line:
                    line = line.replace(line,"TargeWebPage="+paras[0]+"\n")
                elif "AdminName" in line:
                    line = line.replace(line,"AdminName="+paras[1]+"\n")
                elif "AdminPassword" in line:
                    line = line.replace(line,"AdminPassword="+paras[2]+"\n")
                elif "PublicNeworkName" in line:
                    line = line.replace(line,"PublicNeworkName="+paras[3]+"\n")
                elif "PublicSubNeworkName" in line:
                    line = line.replace(line,"PublicSubNeworkName="+paras[4]+"\n")
                elif "Images" in line:
                    line = line.replace(line,"Images="+paras[5]+"\n")
                f_w.write(line)
    else:
        print "No Configure has been write to Default Configure ,Maybe ERROR "
            
if __name__ == "__main__": 
    WriteDefaultC(sys.argv[1:])